package at.fhj.itm11.forum.api;

import java.util.List;

import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.inject.Named;

import org.primefaces.model.UploadedFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import at.fhj.itm11.forum.service.PostService;
import at.fhj.itm11.forum.service.dtos.PostDTO;
import at.fhj.itm11.forum.service.dtos.TopicDTO;
import at.fhj.itm11.forum.service.dtos.UserDTO;

@Stateless
@Remote(PostService.class)
public class PostServiceApi implements PostService {

	private final Logger logger = LoggerFactory.getLogger(getClass());

	@Inject
	@Named("postServiceImpl")
	private PostService service;
	
	@Override
	public List<PostDTO> getPostsByTopicId(long topicId) {
		return service.getPostsByTopicId(topicId);
	}

	@Override
	public long addPost(String title, String text, UploadedFile image,
			UploadedFile video, TopicDTO topic, UserDTO user)
			throws IllegalArgumentException {
		return service.addPost(title, text, image, video, topic, user);
	}

	@Override
	public PostDTO findById(long id) {
		return service.findById(id);
	}

}
